<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>病案-人员浏览统计</title>
</head>
<body>
	<div class="easyui-panel" data-options="fit:true,border:0">
		<div id="MedicalStatisticalBar" class="paddingTBL"> 
				<label>浏览日期&nbsp;</label>
				<input type="text" class="easyui-datebox" id="MedicalStatistical_FDATE1" data-options="width:115,height:24"/>
				<label>&nbsp;至&nbsp;</label>
				<input type="text" class="easyui-datebox" id="MedicalStatistical_FDATE2" data-options="width:115,height:24"/>
				<label class="paddingL">浏览人&nbsp;</label>
				<input type="text" class="" id="MedicalStatistical_FUSERNAME" data-options="width:120,height:24"/>
			    <span class="paddingL"></span>
			    <a href="#" class="easyui-linkbutton" onclick="SumMedicalStatistical()">查询</a>
		</div>
		<table id="MedicalStatisticalGrid"></table>
		
		<!-- 浏览详情Dialog -->
		<div id="MbrowseInfoDialog" class="easyui-dialog"  data-options="closed:true" style="width:600px;height:500px;" >
			<table id="MbrowseInfoGrid"></table>
		</div>
	</div>
	
<script type="text/javascript">

//获取所有浏览人
$("#MedicalStatistical_FUSERNAME").combobox({
	url:ctx + "/Archiving/getAllBrowseName",
	valueField:"fusercode",
	textField:"fusername",
	width:120, 
	height:24
});

//查询
function SumMedicalStatistical(){
	var date1 = $("#MedicalStatistical_FDATE1").datebox("getValue");
	var date2 = $("#MedicalStatistical_FDATE2").datebox("getValue"); 
	var FUSERCODE = $("#MedicalStatistical_FUSERNAME").combobox("getValue");
	var FUSERNAME = $("#MedicalStatistical_FUSERNAME").combobox("getText");
	 
	$("#MedicalStatisticalGrid").datagrid({
		url:ctx + "/MedicalCheckManage/SumMedicalStatistical",
		queryParams:{
			"date1" : date1,
			"date2" : date2, 
			"FUSERCODE":FUSERCODE,
			"FUSERNAME" : FUSERNAME  
		}
	});
}
//初始化表格
$("#MedicalStatisticalGrid").datagrid({
		toolbar:"#MedicalStatisticalBar",
		rownumbers : true,
		fitColumns:true,
		border : false,
		striped : true,
		fit : true,
		singleSelect: true,
		pagination : true,
		pageSize : 20,
		pageList : [ 20, 30,50 ],
		columns:[[ 
			{field:'FUSERNAME',title:'浏览人',width:100,align:'center'}, 
			{field:'sumFTimes',title:'浏览病历数',width:100,align:'center'}, 
			{field:'operation',title:'操作',width:100,align:'center',
				formatter:function(value,row,index){ 
					return "<a href='#' onclick='MbrowseInfo("+index+")'>详情</a>";
				} 
			}
		   ]]
	});


//获取预览详情
function MbrowseInfo(index){ 
	$("#MbrowseInfoDialog").dialog({
		maximizable:true,
        closed: false,
        modal: true,
		title: "人员浏览详情",
		buttons:[{
			text:"关闭",
			handler:function(){
				$('#MbrowseInfoDialog').dialog("close");
			}
		}]
	});
	
	var rowControll = $("#MedicalStatisticalGrid").datagrid("getRows")[index];
	
	var date1 = $("#MedicalStatistical_FDATE1").datebox("getValue");
	var date2 = $("#MedicalStatistical_FDATE2").datebox("getValue");  
	
	$("#MbrowseInfoGrid").datagrid({
		url:ctx + "/MedicalCheckManage/MbrowseInfo",
		toolbar:"",
		queryParams:{
			"FUSERNAME" : rowControll.FUSERNAME,
			"date1":date1,
			"date2":date2
		},
		rownumbers : true,
		fitColumns:true,
		border : false,
		striped : true,
		fit : true,
		singleSelect: true,
		pagination : true,
		pageSize : 20,
		pageList : [ 20, 30,50 ],
		columns:[[
				{field:'FUSERNAME',title:'浏览人',width:100,align:'center'}, 
				{field:'FDATE',title:'浏览日期',width:100,align:'center',
				   formatter:function(value,row,index){
					   return new Date(value).format("yyyy-MM-dd");
				   }	
				},
				{field:'sumFTimes',title:'浏览病历数',width:100,align:'center'}  
		   ]]
	});
}


</script>
</body>
</html>